package erpstatus

import "mall/common/globalkey"

// 推送订单状态
// 0：未创建订单；
// 1：待付款；
// 2：待发货；
// 3：已完成；
// 4：已关闭；
// 5：已发货待确认；
// 6：已签收；
func ErpOrderStatusToOrderStatus(orderStatus uint32) uint32 {
	switch orderStatus {
	//打单配货
	case 0:
		return globalkey.OrderTradeStatePaid
	//打单配货
	case 1:
		return globalkey.OrderTradeStateShipping
	//待发货
	case 4:
		return globalkey.OrderTradeStatePaid

	case 8:
		return globalkey.OrderTradeStateShipped
	case 13:
		return globalkey.OrderTradeStateClosed
	case 5:
		return globalkey.OrderTradeStateDelivered
	case 6:
		return globalkey.OrderTradeStateConfirmed
	default:
		return 0
	}
}

func OrderStatusToErpOrderStatus(orderStatus uint32) uint32 {
	switch orderStatus {
	case globalkey.OrderTradeStatePaid:
		return 2
	case globalkey.OrderTradeStateConfirmed, globalkey.OrderTradeStateAutoConfirmed:
		return 6
	case globalkey.OrderTradeStateFulfilled:
		return 3
	case globalkey.OrderTradeStateClosed:
		return 4
	case globalkey.OrderTradeStateDelivered:
		return 5
	default:
		return 0
	}
}
